package model

import (
	"errors"
	"github.com/doujunyu/gogo/sql_aid"
)

//用户登录

const TableByUserLogin = "self_user_login"

const UserLoginByIsLoginNormal = 1 //正常
const UserLoginByIsLoginForbid = 2 //禁用


// UserLogByUser 个人信息
func UserLogByUser(userId int64) (map[string]interface{},error) {
	userSql, args := sql_aid.PgTable(TableByUserLogin).Field("username","mobile","e_mail","last_login_ip","last_login_time","is_login").Where("user_id = ?", userId).ToSql()
	userData, err := sql_aid.DataToMap(PgSql.Query(userSql, args...))
	if err != nil {
		return nil,err
	}
	if len(userData) == 0 {
		return nil,errors.New("空用户")
	}
	return userData[0],nil
}

